home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v7n15.arc / FILECOPY.BAK < prev    next >
Text File  |  1988-08-09  |  2KB  |  65 lines

  1. 'FileCopy.Bas - demonstration of the FileCopy.Asm routine
  2.  
  3. On Error Goto DiskErr                   'MUST handle critical errors and
  4.                                         '  re-call FileCopy to close source
  5.  
  6. Input "Enter the source file: ", InFile$
  7. Input "Enter the target file: ", OutFile$
  8.  
  9. Free = Fre("")                          'see how big a buffer we can make
  10. If Free > 32849 Then                    'reserve 2 * 64 bytes for file names
  11.    Buffer$ = Space$(32767)
  12. Else
  13.    Buffer$ = Space$(Free - 82)
  14. End If
  15.  
  16. Call FileCopy(InFile$, OutFile$, Buffer$, ErrCode%)
  17.  
  18. Print
  19. If ErrCode% Then                        'did FileCopy detect any errors?
  20.    Print "ERROR: ";
  21.    Select Case ErrCode%
  22.    Case 1
  23.       Msg$ = "Source path cannot be found."
  24.    Case 2
  25.       Msg$ = "Source file does not exist."
  26.    Case 4
  27.       Msg$ = "Source file is a directory."
  28.    Case 5
  29.       Msg$ = "Source file cannot be accessed."
  30.    Case 6
  31.       Msg$ = "Target path cannot be found."
  32.    Case 7
  33.       Msg$ = "Target filename is invalid."
  34.    Case 8
  35.       Msg$ = "Target directory is full."
  36.    Case 9
  37.       Msg$ = "Target file is a directory."
  38.    Case 10
  39.       Msg$ = "Target file is read-only."
  40.    Case 11
  41.       Msg$ = "Target file cannot be accessed."
  42.    Case 12
  43.       Msg$ = "Target disk is full."
  44.    Case 13
  45.       Msg$ = "Not enough string space for copy buffer."
  46.    End Select
  47.    Print Msg$
  48. Else
  49.    Print "Successful completion."
  50. End If
  51.  
  52.  
  53. Done:
  54. Buffer$ = ""            'free up the memory used by Buffer$
  55. End
  56.  
  57.  
  58. DiskErr:                'program will arrive here if a critical error occurred
  59.                         'call FileCopy again to close any open files
  60.  
  61. Print "A DOS critical error occured - check the disk and disk drive."
  62. Call FileCopy(InFile$, OutFile$, Buffer$, -1%)
  63. Resume Done
  64.  
  65.